@@ -609,3 +609,6 @@ DEPENDENCIES |
||
609 | 609 |
weibo_2! |
610 | 610 |
wunderground (~> 1.2.0) |
611 | 611 |
xmpp4r (~> 0.5.6) |
612 |
+ |
|
613 |
+BUNDLED WITH |
|
614 |
+ 1.10.6 |
@@ -46,7 +46,7 @@ module Agents |
||
46 | 46 |
return ["Not Authorized", 401] unless secret == interpolated['secret'] |
47 | 47 |
|
48 | 48 |
#check the verbs |
49 |
- verbs = (interpolated['verbs'] || 'post').split(/,/).map { |x| x.strip.downcase } |
|
49 |
+ verbs = (interpolated['verbs'] || 'post').split(/,/).map { |x| x.strip.downcase }.select { |x| x.present? } |
|
50 | 50 |
return ["Please use #{verbs.join('/').upcase} requests only", 401] unless verbs.include?(method) |
51 | 51 |
|
52 | 52 |
[payload_for(params)].flatten.each do |payload| |
@@ -192,6 +192,14 @@ describe Agents::WebhookAgent do |
||
192 | 192 |
expect(out).to eq(['Event Created', 201]) |
193 | 193 |
end |
194 | 194 |
|
195 |
+ it "should not accept DELETE" do |
|
196 |
+ out = nil |
|
197 |
+ expect { |
|
198 |
+ out = agent.receive_web_request({ 'secret' => 'foobar', 'some_key' => payload }, "delete", "text/html") |
|
199 |
+ }.to change { Event.count }.by(0) |
|
200 |
+ expect(out).to eq(['Please use PUT/POST/GET requests only', 401]) |
|
201 |
+ end |
|
202 |
+ |
|
195 | 203 |
end |
196 | 204 |
|
197 | 205 |
end |